<!DOCTYPE html>
<html lang=zh>
<head>
    <meta charset="utf-8">
    

    <meta name="baidu-site-verification" content="lt822VnP06" />
    <meta name="baidu-site-verification" content="0Ajixw1Puk" />
    <meta name="google-site-verification" content="gCQD0Y6f0YlPTZTAjp_mqms4C7TlkMWrg3Xy0mFdMwI" />
    <title>RabbitMq 如何处理异常 | Giraffe&#39;s Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="这应该是过年假期的最后一篇，如果不是，那你一定看到了假博客。(๑•̀ㅂ•́)و✧">
<meta property="og:type" content="article">
<meta property="og:title" content="RabbitMq 如何处理异常">
<meta property="og:url" content="http://yemengying.com/2017/01/30/how-does-rabbitmq-handle-exception/index.html">
<meta property="og:site_name" content="Giraffe's Home">
<meta property="og:description" content="这应该是过年假期的最后一篇，如果不是，那你一定看到了假博客。(๑•̀ㅂ•́)و✧">
<meta property="og:image" content="https://pic.yupoo.com/jiananshi/1ef2b0c3/ae31063d.jpg">
<meta property="og:updated_time" content="2018-12-13T04:10:36.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="RabbitMq 如何处理异常">
<meta name="twitter:description" content="这应该是过年假期的最后一篇，如果不是，那你一定看到了假博客。(๑•̀ㅂ•́)و✧">
<meta name="twitter:image" content="https://pic.yupoo.com/jiananshi/1ef2b0c3/ae31063d.jpg">
    

    

    
        <link rel="icon" href="https://yemengying.com/qiniu/image/image/favicon.png" />
    


    <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lib/open-sans/styles.css">
    <link rel="stylesheet" href="/lib/source-code-pro/styles.css">

    <link rel="stylesheet" href="/css/style.css">

    <script src="/lib/jquery/2.1.3/jquery.min.js"></script>
    
    
        <link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">
    
    
        <script type="text/javascript">
(function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-75861791-1', 'auto');
ga('send', 'pageview');

</script>
    
    
    
        <script>
var _hmt = _hmt || [];
(function() {
    var hm = document.createElement("script");
    hm.src = "//hm.baidu.com/hm.js?44bb8bfb1a576270255713e37746eb82";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();
</script>

    

</head>
<body>
    <script src="//github.elemecdn.com/jiananshi/req/0.1.0/lib/req.js"></script>
    <script src="//npm.elemecdn.com/jinkela@1.2.18/umd.js"></script>
    <script src="//github.elemecdn.com/jiananshi/DisqusJS/2.0.8/index.js"></script>
    <div id="container">
        <header id="header">
    <div id="header-main" class="header-inner">
        <div class="outer">
            <a href="/" id="logo">
                <i class="logo"></i>
                <span class="site-title">Giraffe&#39;s Home</span>
            </a>
            <nav id="main-nav">
                
                    <a class="main-nav-link" href="/.">首页</a>
                
                    <a class="main-nav-link" href="/archives">归档</a>
                
                    <a class="main-nav-link" href="/categories">分类</a>
                
                    <a class="main-nav-link" href="/tags">标签</a>
                
                    <a class="main-nav-link" href="/about">关于</a>
                
                    <a class="main-nav-link" href="/message">留言</a>
                
                    <a class="main-nav-link" href="/friends">友链</a>
                
                    <a class="main-nav-link" href="/reading">正在读...</a>
                
            </nav>
            
                
                <nav id="sub-nav">
                    <div class="profile" id="profile-nav">
                        <a id="profile-anchor" href="javascript:;">
                            <img class="avatar" src="https://pic.yupoo.com/jiananshi/e85e4303/735cf286.jpeg" />
                            <i class="fa fa-caret-down"></i>
                        </a>
                    </div>
                </nav>
            
            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="想要查找什么..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>

</div>
        </div>
    </div>
    <div id="main-nav-mobile" class="header-sub header-inner">
        <table class="menu outer">
            <tr>
                
                    <td><a class="main-nav-link" href="/.">首页</a></td>
                
                    <td><a class="main-nav-link" href="/archives">归档</a></td>
                
                    <td><a class="main-nav-link" href="/categories">分类</a></td>
                
                    <td><a class="main-nav-link" href="/tags">标签</a></td>
                
                    <td><a class="main-nav-link" href="/about">关于</a></td>
                
                    <td><a class="main-nav-link" href="/message">留言</a></td>
                
                    <td><a class="main-nav-link" href="/friends">友链</a></td>
                
                    <td><a class="main-nav-link" href="/reading">正在读...</a></td>
                
                <td>
                    
    <div class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
    </div>

                </td>
            </tr>
        </table>
    </div>
</header>

        <div class="outer">
            
                

<aside id="profile">
    <div class="inner profile-inner">
        <div class="base-info profile-block">
            <img id="avatar" src="https://pic.yupoo.com/jiananshi/e85e4303/735cf286.jpeg" />
            <h2 id="name">Giraffe</h2>
            <h3 id="title">Java Developer</h3>
            <span id="location"><i class="fa fa-map-marker"></i>Shanghai, China</span>
            <a id="follow" target="_blank" href="https://github.com/giraffe0813/">关注我</a>
        </div>
        <div class="article-info profile-block">
            <div class="article-info-block">
                56
                <span>文章</span>
            </div>
            <div class="article-info-block">
                36
                <span>标签</span>
            </div>
        </div>
        <div class="profile-block recent-comments">
            <p class="recent-comments-title">最新评论</p>
            <ul id="disqus-recent-comments" class="recent-comments-container">
            </ul>
        </div>
        
        <div class="profile-block social-links">
            <table>
                <tr>
                    
                    
                    <td>
                        <a href="http://github.com/giraffe0813" target="_blank" title="github" class=tooltip>
                            <i class="fa fa-github"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/atom.xml" target="_blank" title="rss" class=tooltip>
                            <i class="fa fa-rss"></i>
                        </a>
                    </td>
                    
                </tr>
            </table>
        </div>
        
    </div>
</aside>

            
            <section id="main"><article id="2017/01/30/how-does-rabbitmq-handle-exception/" class="article article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
        
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
            RabbitMq 如何处理异常
        </h1>
    

                <div class="article-meta">
                    
    <div class="article-date">
        <i class="fa fa-calendar"></i>
        <a href="/2017/01/30/how-does-rabbitmq-handle-exception/">
            <time datetime="2017-01-30T11:37:21.000Z" itemprop="datePublished">2017-01-30</time>
        </a>
    </div>


                    
    <div class="article-category">
    	<i class="fa fa-folder"></i>
        <a class="article-category-link" href="/categories/rabbitmq/">rabbitmq</a>
    </div>

                    
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/rabbitmq/">rabbitmq</a>, <a class="tag-link" href="/tags/spring/">spring</a>
    </div>

                </div>
            </header>
        
        <div class="article-entry" itemprop="articleBody">
        
            
                <div id="toc" class="toc-article">
                <strong class="toc-title">文章目录</strong>
                    
                </div>
            
            <blockquote>
<p>这应该是过年假期的最后一篇，如果不是，那你一定看到了假博客。(๑•̀ㅂ•́)و✧  </p>
</blockquote>
<a id="more"></a>
<p>在消费 RabbitMq 中的 Message 时，常常会出现异常，可能是 Message 本身格式不对，或者由于某些原因无法被处理。我一般都是 catch 异常然后抛个 <code>AmqpRejectAndDontRequeueException</code>  (以下简称 ARADRE )，也出啥问题，不过还是仔细看下，rabbitmq 是如何对待消费消息时出现的异常，是会将消息直接丢弃还是有其他操作。</p>
<p>其实 Spring-amqp <a href="http://docs.spring.io/spring-amqp/reference/html/_reference.html#exception-handling" target="_blank" rel="external">官方文档</a>上对于 RabbitMq 是如何处理异常的说的已经很明白了，不过都是大段的文字可能不太好理解，还是配着代码看一下。</p>
<p>代码版本： 1.6.3.RELEASE</p>
<p>根据官方文档，当 listener 在消费消息时抛出一个异常的时候，该异常会被包装在 <code>ListenerExecutionFailedException</code> 中抛出，并根据 <code>listenerContainer</code> 中 <code>defaultRequeueRejected</code> 设定的值来决定是否将该消息重新加入队列，默认是会重新加入队列。</p>
<p><img src="https://pic.yupoo.com/jiananshi/1ef2b0c3/ae31063d.jpg" alt="ListenerExecutionFailedException结构"></p>
<p>需要注意的是，如果抛出的异常是 ARADRE 或其他被 RabbitMq 认为是致命错误的异常，即便 defaultRequeueRejected 的值为 true ， 该消息也不会重新加入队列，而是会被直接丢弃或加入 dead-letter-exchange 中(如果有配置 dead-letter-exchange)。</p>
<p><img src="https://pic.yupoo.com/jiananshi/1a0a19a6/1c5104d9.jpeg" alt="来源https://derickbailey.com/2016/03/28/dealing-with-dead-letters-and-poison-messages-in-rabbitmq/"></p>
<p>在 1.6.3. RELEASE 中被 RabbitMq 认为是致命错误的异常有以下 6 种：</p>
<ul>
<li>o.s.amqp…MessageConversionException</li>
<li>o.s.messaging…MessageConversionException</li>
<li>o.s.messaging…MethodArgumentNotValidException</li>
<li>o.s.messaging…MethodArgumentTypeMismatchException</li>
<li>java.lang.NoSuchMethodException</li>
<li>java.lang.ClassCastException</li>
</ul>
<p>也就是说，当抛出以上异常及 ARADRE 时，该消息一定不会重新入队，即便 defaultRequeueRejected 的值为 true。</p>
<p>下面看看 Spring-RabbitMq 是如何实现的：</p>
<p>在源码中，异常在 <code>AbstractMessageListenerContainer</code> 中被包装在 ListenerExecutionFailedException 中之后还会经由 <code>ErrorHandler</code> 的 <code>handleError</code> 方法处理， 默认的 ErrorHandler 是 <code>ConditionalRejectingErrorHandler</code> 。 </p>
<p>我们也可以实现自己的 ErrorHandler 来控制需要丢弃消息的异常，只要实现  <code>org.springframework.util.ErrorHandler</code> 接口，然后将<code>listenerContainer</code> 中的 <code>errorHandler</code> 参数指定我们自定义的 handler 即可。 </p>
<p>ConditionalRejectingErrorHandler 中配置有 <code>FatalExceptionStrategy</code>，会调用 FatalExceptionStrategy 中的 isFatal 方法来判断异常是不是属于致命异常。</p>
<p>ConditionalRejectingErrorHandler 的具体实现如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ConditionalRejectingErrorHandler</span> <span class="keyword">implements</span> <span class="title">ErrorHandler</span> </span>&#123;</div><div class="line"></div><div class="line"><span class="keyword">private</span> <span class="keyword">final</span> FatalExceptionStrategy exceptionStrategy;	</div><div class="line"><span class="meta">@Override</span></div><div class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">handleError</span><span class="params">(Throwable t)</span> </span>&#123;</div><div class="line">	<span class="keyword">if</span> (<span class="keyword">this</span>.logger.isWarnEnabled()) &#123;</div><div class="line">		<span class="keyword">this</span>.logger.warn(<span class="string">"Execution of Rabbit message listener failed."</span>, t);</div><div class="line">	&#125;</div><div class="line">	<span class="comment">// 如果是致命异常，则转为 AmqpRejectAndDontRequeueException 抛出</span></div><div class="line">	<span class="keyword">if</span> (!<span class="keyword">this</span>.causeChainContainsARADRE(t) &amp;&amp; <span class="keyword">this</span>.exceptionStrategy.isFatal(t)) &#123;</div><div class="line">		<span class="keyword">throw</span> <span class="keyword">new</span> AmqpRejectAndDontRequeueException(<span class="string">"Error Handler converted exception to fatal"</span>, t);</div><div class="line">	&#125;</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="comment">/**</span></div><div class="line"> * <span class="doctag">@return</span> true if the cause chain already contains an</div><div class="line"> * &#123;<span class="doctag">@link</span> AmqpRejectAndDontRequeueException&#125;.</div><div class="line"> */</div><div class="line"><span class="function"><span class="keyword">private</span> <span class="keyword">boolean</span> <span class="title">causeChainContainsARADRE</span><span class="params">(Throwable t)</span> </span>&#123;</div><div class="line">	Throwable cause = t.getCause();</div><div class="line">	<span class="keyword">while</span> (cause != <span class="keyword">null</span>) &#123;</div><div class="line">		<span class="keyword">if</span> (cause <span class="keyword">instanceof</span> AmqpRejectAndDontRequeueException) &#123;</div><div class="line">			<span class="keyword">return</span> <span class="keyword">true</span>;</div><div class="line">		&#125;</div><div class="line">		cause = cause.getCause();</div><div class="line">	&#125;</div><div class="line">	<span class="keyword">return</span> <span class="keyword">false</span>;</div><div class="line">&#125;</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment">/**</span></div><div class="line"> * Default implementation of &#123;<span class="doctag">@link</span> FatalExceptionStrategy&#125;.</div><div class="line"> * <span class="doctag">@since</span> 1.6.3</div><div class="line"> */</div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">DefaultExceptionStrategy</span> <span class="keyword">implements</span> <span class="title">FatalExceptionStrategy</span> </span>&#123;</div><div class="line"></div><div class="line">	<span class="comment">// 判断传入参数 是不是 致命异常</span></div><div class="line">	<span class="meta">@Override</span></div><div class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">isFatal</span><span class="params">(Throwable t)</span> </span>&#123;</div><div class="line">		<span class="keyword">if</span> (t <span class="keyword">instanceof</span> ListenerExecutionFailedException</div><div class="line">				&amp;&amp; isCauseFatal(t.getCause())) &#123;</div><div class="line">			<span class="keyword">if</span> (ConditionalRejectingErrorHandler.<span class="keyword">this</span>.logger.isWarnEnabled()) &#123;</div><div class="line">				ConditionalRejectingErrorHandler.<span class="keyword">this</span>.logger.warn(</div><div class="line">							<span class="string">"Fatal message conversion error; message rejected; "</span></div><div class="line">							+ <span class="string">"it will be dropped or routed to a dead letter exchange, if so configured: "</span></div><div class="line">							+ ((ListenerExecutionFailedException) t).getFailedMessage());</div><div class="line">			&#125;</div><div class="line">			<span class="keyword">return</span> <span class="keyword">true</span>;</div><div class="line">		&#125;</div><div class="line">		<span class="keyword">return</span> <span class="keyword">false</span>;</div><div class="line">	&#125;</div><div class="line"></div><div class="line">	<span class="function"><span class="keyword">private</span> <span class="keyword">boolean</span> <span class="title">isCauseFatal</span><span class="params">(Throwable cause)</span> </span>&#123;</div><div class="line">		<span class="keyword">return</span> cause <span class="keyword">instanceof</span> MessageConversionException</div><div class="line">				|| cause <span class="keyword">instanceof</span> org.springframework.messaging.converter.MessageConversionException</div><div class="line">				|| cause <span class="keyword">instanceof</span> MethodArgumentNotValidException</div><div class="line">				|| cause <span class="keyword">instanceof</span> MethodArgumentTypeMismatchException</div><div class="line">				|| cause <span class="keyword">instanceof</span> NoSuchMethodException</div><div class="line">				|| cause <span class="keyword">instanceof</span> ClassCastException</div><div class="line">				|| isUserCauseFatal(cause);</div><div class="line">	&#125;</div><div class="line"></div><div class="line">	<span class="comment">/**</span></div><div class="line">	 * 通过重写该方法来添加自定义的异常</div><div class="line">	 * Subclasses can override this to add custom exceptions.</div><div class="line">	 * <span class="doctag">@param</span> cause the cause</div><div class="line">	 * <span class="doctag">@return</span> true if the cause is fatal.</div><div class="line">	 */</div><div class="line">	<span class="function"><span class="keyword">protected</span> <span class="keyword">boolean</span> <span class="title">isUserCauseFatal</span><span class="params">(Throwable cause)</span> </span>&#123;</div><div class="line">		<span class="keyword">return</span> <span class="keyword">false</span>;</div><div class="line">	&#125;</div><div class="line"></div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>代码比较长，简单来说，就是 ConditionalRejectingErrorHandler 的 handleError 会先判断接到的异常中的 cause 是不是 ARADRE，如果不是再调用 FatalExceptionStrategy 的 isFatal 方法，判断是不是致命异常中的一种，如果是，则将异常转为 ARADRE 抛出，该消息也就不会重新入队。</p>
<p>如果想要把自定义的异常加入到 fatalException， 一个简单的办法就是提供新的 FatalExceptionStrategy ，只要继承 ConditionalRejectingErrorHandler.DefaultExceptionStrategy 并重写 isUserCauseFatal(Throwable cause) 方法，在方法里对于需要丢弃消息的异常返回 true即可。</p>
<p>再简单看下，RabbitMq 判断是否需要将消息重入队列的部分逻辑。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// We should always requeue if the container was stopping</span></div><div class="line"><span class="keyword">boolean</span> shouldRequeue = <span class="keyword">this</span>.defaultRequeuRejected || ex <span class="keyword">instanceof</span> MessageRejectedWhileStoppingException;</div><div class="line">Throwable t = ex;</div><div class="line"><span class="keyword">while</span> (shouldRequeue &amp;&amp; t != <span class="keyword">null</span>) &#123;</div><div class="line">	<span class="keyword">if</span> (t <span class="keyword">instanceof</span> AmqpRejectAndDontRequeueException) &#123;</div><div class="line">			shouldRequeue = <span class="keyword">false</span>;</div><div class="line">	&#125;</div><div class="line">	t = t.getCause();</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>根据上面的代码，如果处理消息时出现异常，在判断是否需要入队时，会将 shouldRequeue 变量等于 this.defaultRequeuRejected ||ex instanceof MessageRejectedWhileStoppingException 的值，然后如果异常是 ARADRE， 不管之前 shouldRequeue 的值是什么，都会被置为 false。最后根据 shouldRequeue 的值来决定是否需要重新入队。 </p>
<p>可以用下图总结一下：<br><img src="//yemengying.com/qiniu/image/2017-02-05-j%20-1-.png?imageMogr2/thumbnail/667x618!" alt="总结"></p>
<p>最后。。Cookie 宝宝祝大家新春快乐~~<br><img src="https://pic.yupoo.com/jiananshi/6bcb0d8b/1461eb70.jpg" alt="cookie 宝宝"></p>

        
        </div>
        <footer class="article-footer">
            <div class="share-container">



</div>

    <a data-url="http://yemengying.com/2017/01/30/how-does-rabbitmq-handle-exception/" data-id="cjtvbuchr0014z15sfp908nis" class="article-share-link"><i class="fa fa-share"></i>分享到</a>
<script>
    (function ($) {
        // Prevent duplicate binding
        if (typeof(__SHARE_BUTTON_BINDED__) === 'undefined' || !__SHARE_BUTTON_BINDED__) {
            __SHARE_BUTTON_BINDED__ = true;
        } else {
            return;
        }
        $('body').on('click', function() {
            $('.article-share-box.on').removeClass('on');
        }).on('click', '.article-share-link', function(e) {
            e.stopPropagation();

            var $this = $(this),
                url = $this.attr('data-url'),
                encodedUrl = encodeURIComponent(url),
                id = 'article-share-box-' + $this.attr('data-id'),
                offset = $this.offset(),
                box;

            if ($('#' + id).length) {
                box = $('#' + id);

                if (box.hasClass('on')){
                    box.removeClass('on');
                    return;
                }
            } else {
                var html = [
                    '<div id="' + id + '" class="article-share-box">',
                        '<input class="article-share-input" value="' + url + '">',
                        '<div class="article-share-links">',
                            '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="fa fa-twitter article-share-twitter" target="_blank" title="Twitter"></a>',
                            '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="fa fa-facebook article-share-facebook" target="_blank" title="Facebook"></a>',
                            '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="fa fa-pinterest article-share-pinterest" target="_blank" title="Pinterest"></a>',
                            '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="fa fa-google article-share-google" target="_blank" title="Google+"></a>',
                        '</div>',
                    '</div>'
                ].join('');

              box = $(html);

              $('body').append(box);
            }

            $('.article-share-box.on').hide();

            box.css({
                top: offset.top + 25,
                left: offset.left
            }).addClass('on');

        }).on('click', '.article-share-box', function (e) {
            e.stopPropagation();
        }).on('click', '.article-share-box-input', function () {
            $(this).select();
        }).on('click', '.article-share-box-link', function (e) {
            e.preventDefault();
            e.stopPropagation();

            window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
        });
    })(jQuery);
</script>

            
    
        <a href="http://yemengying.com/2017/01/30/how-does-rabbitmq-handle-exception/#comments" class="article-comment-link disqus-comment-count" data-disqus-url="http://yemengying.com/2017/01/30/how-does-rabbitmq-handle-exception/">评论</a>
    

        </footer>
    </div>
    
        
<nav id="article-nav">
    
        <a href="/2017/02/18/something-about-noSuchBeanDefinitionException/" id="article-nav-newer" class="article-nav-link-wrap">
            <strong class="article-nav-caption">上一篇</strong>
            <div class="article-nav-title">
                
                    谈谈 NoSuchBeanDefinitionException
                
            </div>
        </a>
    
    
        <a href="/2017/01/03/rabbitmq-classMapper/" id="article-nav-older" class="article-nav-link-wrap">
            <strong class="article-nav-caption">下一篇</strong>
            <div class="article-nav-title">为Rabbitmq中的Jackson2JsonMessageConverter自定义ClassMapper</div>
        </a>
    
</nav>


    
    <script>
   DisqusJS.getArticleComments();
   </script>
</article>


    
    <section id="comments">
    
        
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>

    
    </section>

</section>
            
        </div>
        <footer id="footer">
    <div class="outer">
        <div id="footer-info" class="inner">
            &copy; 2019 Mengying Ye<br>
            Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
        </div>
    </div>
</footer>
        
    
   <script>
   DisqusJS.getRecentComments(document.querySelector('#disqus-recent-comments'));
   </script>



    
        <script src="/lib/fancybox/jquery.fancybox.pack.js"></script>
    


<!-- Custom Scripts -->
<script src="/js/main.js"></script>

    </div>
</body>
</html>
